import QtQuick 2.6

Rectangle {
    id: customRect
    property int horizontalPadding: 0
    property int verticalPadding: 0

    Component.onCompleted: {
        customRect.width = customRect.width - 2 * horizontalPadding
        customRect.height = customRect.height - 2 * verticalPadding
    }

    // 创建一个内部的 Item 用于放置子元素
    Item {
        id: contentItem
        anchors.fill: parent
        anchors.leftMargin: horizontalPadding
        anchors.rightMargin: horizontalPadding
        anchors.topMargin: verticalPadding
        anchors.bottomMargin: verticalPadding
    }

    // 将 contentItem 作为默认的子组件容器
    default property alias children: contentItem.children
}
